<template>
  <el-dialog
      width="95%"
      title="表格预览"
      v-model="dialogVisible"
      :before-close="onClose"
      append-to-body>
    <avue-crud v-if="tableOption"
               v-bind="bindVal"
               v-on="onEvent"
               v-model:page="page"
               v-model="form">
      <template v-for="(column,index) in columns" :slot="column.prop" slot-scope="{type,size,row}">
        <component :is="column.columnComponent" :row="row" :rowKey="column.prop"></component>
      </template>
    </avue-crud>

  </el-dialog>
</template>

<script>
import startFormEngineCrud from "@/mixins/start-form-engine-crud"

export default startFormEngineCrud({
  name: "formPreviewData",
  computed: {},
  data() {
    return {
      dialogVisible: false,
    }
  },
  methods: {
    show(tableId) {
      this.tableId = tableId
      this.loadTableConfig()
      this.dialogVisible = true
    },
    loadCrudColumnBefore(column) {
      if (column.type === 'dynamic') {
        column.hide = true;
        column.search = false
      }
    },

    onClose() {
      this.dialogVisible = false
    }
  }
}, {autoLoad: false})
</script>

<style scoped>

</style>
